package com.css.listener;

import com.css.listener.interfaces.Status;

/**
 * <p>
 * -
 * </p>
 *
 * @author css
 * @since 2021/4/7
 */
public class Monitor {
    private KeyListener keyListener;
    private MouseListener mouseListener;
    private boolean isOpen = false;

    public Monitor() {
        keyListener = new KeyListener();
        mouseListener = new MouseListener();
    }

    public boolean startOrStop() {
        if (isOpen) {
            keyListener.stop();
            mouseListener.stop();
        } else {
            keyListener.start();
            mouseListener.start();
        }
        isOpen = !isOpen;
        return isOpen;
    }

    public boolean isOpen() {
        return isOpen;
    }
}
